package com.xinchuang.service.impl;

import com.xinchuang.entity.DfQuotationPrice;
import com.xinchuang.entity.OuterDesignChangePrice;
import com.xinchuang.mapper.OuterDesignChangePriceMapper;
import com.xinchuang.service.IOuterDesignChangePriceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.compress.utils.Lists;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author baomidou
 * @since 2023-09-06
 */
@Service
public class OuterDesignChangePriceServiceImpl extends ServiceImpl<OuterDesignChangePriceMapper, OuterDesignChangePrice> implements IOuterDesignChangePriceService {
    public void init(String moldSelectionId, String subTableId) {
        List<OuterDesignChangePrice> list = Lists.newArrayList();
        for(OuterDesignChangePriceServiceImpl.OuterDesignChangePriceEnum d : OuterDesignChangePriceServiceImpl.OuterDesignChangePriceEnum.values()) {
            OuterDesignChangePrice outerDesignChangePrice = new OuterDesignChangePrice();
            outerDesignChangePrice.setMoldSelectionId(moldSelectionId);
            outerDesignChangePrice.setDesignChangeId(subTableId);
            outerDesignChangePrice.setType(d.type);
            outerDesignChangePrice.setName(d.name);
            list.add(outerDesignChangePrice);
        }
        saveBatch(list);
    }

    public enum OuterDesignChangePriceEnum {
        T1("设计费用", "设计"),
        T2("设计费用", "编程"),
        T3("设计费用", "CAE"),
        T4("加工费用", "钳工"),
        T5("加工费用", "CNC"),
        T6("加工费用", "EDM"),
        T7("加工费用", "线切割"),
        T8("加工费用", "普加"),
        T9("加工费用", "热处理"),
        T10("加工费用", "合模机"),
        T11("加工费用", "烧焊"),
        T12("加工费用", "抛光"),
        T13("检测费用", "装配检测"),
        T14("试模费用", ""),
        T15("运输费用", "汽运"),
        T16("运输费用", "空运"),
        T17("材料费用", "材料"),
        T18("材料费用", "电极"),
        T19("材料费用", "标件"),
        T20("材料费用", "热流道"),
        T21("材料费用", "其他"),
        T22("其它费用", "管理费"),
        T23("其它费用", "利润"),
        T24("其它费用", "税收");
        private String type;
        private String name;

        OuterDesignChangePriceEnum(String type, String name) {
            this.type = type;
            this.name = name;
        }
    }
}
